<?php
/**
 * Describes relations between pages and menus through link table
 * 
 * @author Konstantin Shamko <konstantin.shamko@gmail.com> 
 * @version 0.0.1
 * @copyright  Copyright (c) 2009 Konstantin Shamko
 * @category VaselinEngine
 * @package Content Module
 * @subpackage Model
 * @license  New BSD License
 *
 */
class Models_Content_Page2menu extends Bel_Model_Abstract {
	
	/**
	 * Table primary key
	 *
	 * @var array
	 */
	protected $_primary = array ('entry_id' );
	
	/**
	 * Array describes relation rules between pages & menus. Relation between pages & menus is many-to-many.
	 *
	 * @var array
	 */
	protected $_referenceMap = array (
		'page' => array (
			'columns' => 'page_id', 
			'refTableClass' => 'Models_Content_Pages', 
			'refColumns' => 'page_id', 
			'onDelete' => self::CASCADE ), 
		'group' => array (
			'columns' => 'menu_id', 
			'refTableClass' => 'Models_Content_Menus', 
			'refColumns' => 'menu_id', 
			'onDelete' => self::CASCADE));
	
	/**
	 * Constructor to set name of a table that links pages & menus tables in a database.
	 * 
	 * @param  mixed $config Array of user-specified config options - ZendFramework feature.
	 * @return void
	 */
	public function __construct($array = array()) {
		$this->_name = TABLE_PREFIX . "page2menu";
		parent::__construct ( $array );
	}
}